package com.lxyk.dao.student;

import com.lxyk.domain.StudentVO3;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface QuitDao {

    //添加休学信息
    @Insert("insert into quit values(null,#{statusQuit},#{applyTime},#{deadline},#{person},#{reason},#{sid})")
    void addQuit(StudentVO3 student);

    //修改休学信息
    @Update("update quit set statusQuit=0 where sid=#{id}")
    void updateQuit(StudentVO3 student);

    //修改学生标识
    @Update("update student set quitFlag=1 where id=#{id}")
    void updateStudent(StudentVO3 student);

    //查询当前班级所有休学信息
    @Select("select * from student,classes,quit where student.cid=classes.id and student.id=quit.sid and quit.statusQuit=0 and cid=#{cid}")
    List<StudentVO3> quitByCid(Integer cid);

    //根据id查询休学信息
    @Select("select * from student,classes where student.cid=classes.id and student.id=#{id}")
    StudentVO3 findQuitById(Integer id);

    //根据条件模糊查询休学信息
    List<StudentVO3> findQuitByCondition(StudentVO3 vo);

    //查询当前班级休学人数
    @Select("SELECT count(*) from student,classes,quit where student.cid=classes.id and student.id=quit.sid and quit.statusQuit=0 and cid=#{cid}")
    int findCountByCid(Integer cid);

}
